VERSION=6.9.0
COMPILER=g++
#TCLDIR=/opt/ActiveTcl-8.4
#TCLLIBDIR=$(TCLDIR)/lib
#TCLINCLUDE=$(TCLDIR)/include
TCLLIBDIR=/usr/lib
TCLINCLUDEDIR=/usr/include/tcl8.4
TCL=tclstub8.4
ARCHTYPE=$(shell uname -m)
ifeq ($(ARCHTYPE),x86_64)
    COMPILE_BITS=64
    RTCE_LIB_BITS=64
else
    COMPILE_BITS=32
    RTCE_LIB_BITS=
endif
RTCEPUBSUBINCLUDEDIR=/opt/RTCE/PubSub_2.1.1_b15/cpp/include
RTCEPUBSUBLIBDIR=/opt/RTCE/PubSub_2.1.1_b15/cpp/lib$(RTCE_LIB_BITS)
RTCEPUBSUB=vhpubsub
CXXFLAGS = -Wall -Wno-long-long -pedantic -DLinux -D_REENTRANT -m$(COMPILE_BITS) -lnsl -lpthread -lrt -DUSE_TCL_STUBS -fPIC
MODULEFLAGS = -shared
OUTPUTDIR=./lib/tclva$(VERSION)
INCLUDES = -I./ -I$(TCLINCLUDEDIR) -I/usr/include/boost -I./cpptcl-1.1.3/ -I$(RTCEPUBSUBINCLUDEDIR)
LIBDIRS = -L$(TCLLIBDIR) -L$(RTCEPUBSUBLIBDIR)
LIBS = -l$(RTCEPUBSUB) -l$(TCL) 

OUTPUTS = tclva.so

SOURCES = \
    tclva.cpp \
    cpptcl-1.1.3/cpptcl.cc \
    SubscriberListener.cpp

all : ${OUTPUTS}
    
tclva.so : $(SOURCES)
	${COMPILER} ${MODULEFLAGS} $(SOURCES) -o $(OUTPUTDIR)/$@ ${CXXFLAGS} ${INCLUDES} ${LIBDIRS} ${LIBS}
    
clean :
	rm -f ${OUTPUTS}
